package com.athuiju.hr.controller;


import com.athuiju.commonutils.R;
import com.athuiju.hr.entity.Grades;
import com.athuiju.hr.service.GradesService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wzh
 * @since 2021-12-15
 */
@RestController
@Api(value="职级列表controller",tags={"员工职级列表操作接口"})
@RequestMapping("/hr/grades")
public class GradesController {
    @Autowired
    public GradesService gradesService;

    @ApiOperation(value = "查询全部职级")
    @GetMapping("gradesAll")
    @ApiResponses({@ApiResponse(code = 200,message = "OK",response = Grades.class),
    })
    public R list(){
        List<Grades> list=gradesService.list(null);
        return  R.ok().data("item",list);
    }




    @ApiOperation(value = "根据id查询职级信息")
    @GetMapping("getGradesInfo/{id}")
    @ApiResponses({@ApiResponse(code = 200,message = "OK",response = Grades.class),
    })
    public R getGradesInfo(@ApiParam(name = "id",value = "职级id",required = true)
                          @PathVariable String id){
        Grades grades=gradesService.getById(id);
        return  R.ok().data("grades",grades);
    }

}

